<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MVCWeb.Models.ViewData.VendorCommunityAdsNewViewData>" %>

<%@ Import Namespace="MVCWeb.Helpers" %>
<%@ Register Src="~/Views/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="mmuc" %>

<%@ Register Src="~/Views/Shared/LogOnUserControl.ascx" TagName="LogOnUserControl" TagPrefix="louc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <script type="text/javascript">
        $(document).ready(function() {
            $("#VendorAdsCommunityForm").validate({
                rules: {
                    Name: {
                        required: true
                    },
                    FullPath: {
                        required: true
                    }

                },
                messages: {
                    Name: {
                        required: "Name cannot be blank"
                    },
                    FullPath: {
                        required: "File cannot be blank"
                    }
                }
            });
            $("#submit_view").click(function() {
                $("#IsRedirectToView").val("true");
            });
        });
    </script>

    <louc:LogOnUserControl ID="LogOnUserControl1" runat="server" />
    <!-- BEGIN: MainMenu -->
    <mmuc:MainMenu ID="MainMenu1" runat="server" />
    <!-- END: MainMenu -->
    <br />
    <%= Html.ValidationSummary("Create was unsuccessful. Please correct the errors and try again.") %>
    <% using (Html.BeginForm("Edit", "VendorCommunityAds", FormMethod.Post, new { id = "VendorAdsCommunityForm" }))
       {%>
    <fieldset>
        <legend>Create Ads for community</legend>
        <p>
            <label for="VendorId">
                Choose a vendor:</label>
            <%= Html.DropDownList("VendorId", new SelectList(ViewData.Model.VendorList, "VendorId", "VendorName", ViewData.Model.VendorCommunityAds.VendorId))%>
        </p>
        <p>
            <label for="AdsId">
                Choose a Ads:</label>
            <%= Html.DropDownList("AdsId", new SelectList(ViewData.Model.AdsList, "AdsId", "Type", ViewData.Model.VendorCommunityAds.AdsId))%>
        </p>
        <p>
            <label for="Active">
                Active:</label>
            <%= Html.CheckBox("Active", ViewData.Model.VendorCommunityAds.Active.Value)%>
        </p>
        <p>
            <label for="Started">
                Started:</label>
            <%= Html.TextBox("Started", ViewData.Model.VendorCommunityAds.Started.Value.ToShortDateString())%>
        </p>
        <p>
            <label for="Ended">
                Ended:</label>
            <%= Html.TextBox("Ended", ViewData.Model.VendorCommunityAds.Ended.Value.ToShortDateString())%>
        </p>
        <p>
            <%= Html.Hidden("IsRedirectToView")%>
            <input id="submit" name="submit" type="submit" value="Update" />
            <input id="submit_view" name="submit_view" type="submit" value="Update & View" />            
            <input type="reset" value="Reset" />
        </p>
        <%= Html.Hidden("CommunityId", Session["CommunityId"] == null ? "" : Session["CommunityId"].ToString()) %>  
        <%= Html.Hidden("vId", Request.QueryString["VendorId"]) %>  
        <%= Html.Hidden("aId", Request.QueryString["AdsId"])%>  
    </fieldset>
    <% } %>
    <div>
        <%=Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <title>Create Ads for Community</title>
</asp:Content>
